home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name fldelete -- Delete a file
- *
- * Synopsis ercode = fldelete(pfile);
- * int ercode DOS function return error code
- * char *pfile Full path name of file to delete
- *
- * Description This function deletes the file specified in the path
- * name. Note that read only files cannot be deleted
- * until their attribute is changed (use FLSETATR).
- * Directories cannot be deleted with FLDELETE.
- *
- * Returns ercode DOS 2.0 function return error code
- *
- * Version 1.1 (C)Copyright Blaise Computing Inc. 1983, 1984
- *
- **/
- #include <compiler.h>
-
- struct dreg
- {
- unsigned ax,bx,cx,dx,si,di,ds,es;
- };
- #define DOSREG struct dreg
-
- int fldelete(pfile)
- char *pfile;
- {
-
- DOSREG dos_reg;
- int utinit(),dos();
- #if CI201A & LDATA
- unsigned long ptrtoabs();
- #endif
-
- utinit(&dos_reg); /* Initialize registers */
- dos_reg.ax = 0x4100; /* DOS function 41 */
- #if LDATA
- #if CI201A
- dos_reg.ds = (unsigned)((ptrtoabs(pfile) & 0xffff0L) >> 4L);
- dos_reg.dx = (unsigned)(ptrtoabs(pfile) & 0xfL);
- #else
- dos_reg.ds = (unsigned)(((long)(pfile) & 0xffff0L) >> 4L);
- dos_reg.dx = (unsigned)((long)(pfile) & 0xfL);
- #endif
- #else
- dos_reg.dx = (unsigned)pfile;
- #endif
-
- return(dos(&dos_reg));
-
- }